/* GUI CONVERTED from rsshmta.p (converter v1.76) Mon Jul 22 11:49:59 2002 */
/* rsshmta.p - Release Management Shipper Maintenance                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.1.12 $                                                      */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 10/12/92   BY: WUG *G462*                  */
/* REVISION: 7.3    LAST MODIFIED: 10/04/93   BY: WUG *GG13*                  */
/* REVISION: 7.3    LAST MODIFIED: 03/04/95   BY: jxz *G0GG*                  */
/* REVISION: 7.3    LAST MODIFIED: 03/29/95   BY: dzn *F0PN*                  */
/* REVISION: 7.3    LAST MODIFIED: 01/18/96   BY: kjm *G1KB*                  */
/* REVISION: 7.3    LAST MODIFIED: 02/22/96   BY: ais *G1NT*                  */
/* REVISION: 8.6    LAST MODIFIED: 04/02/97   BY: *K09H* Vinay Nayak-Sujir    */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* Annasaheb Rahane     */
/* REVISION: 8.6E   LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan           */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown           */
/* REVISION: 9.1    LAST MODIFIED: 08/30/00   BY: *M0S1* Abhijeet Thakur      */
/* Revision: 1.6.1.4      BY: Jean Miller         DATE: 05/20/02  ECO: *P05V* */
/* Revision: 1.6.1.5      BY: Tiziana Giustozzi   DATE: 05/24/02  ECO: *P03Z* */
/* Revision: 1.6.1.6      BY: Jean Miller         DATE: 06/07/02  ECO: *P080* */
/* Revision: 1.6.1.11     BY: Tiziana Giustozzi   DATE: 06/17/02  ECO: *P08H* */
/* $Revision: 1.6.1.12 $  BY: Robin McCarthy      DATE: 07/15/02  ECO: *P0BJ* */

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* Maintain list of subcontainers */

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter abs_recid as recid.

define buffer abs_mstr_cont for abs_mstr.

define variable del-yn like mfc_logical.
define variable wt_conv as decimal.
define variable vol_conv as decimal.
define variable abs_cont_id like abs_id format "x(12)".
define variable use-log-acctg   as logical    no-undo.
define variable undo-retry as logical no-undo.

define shared variable global_recid as recid.

do for abs_mstr_cont:
   
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
      
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
abs_cont_id       colon 20 label "Container ID"
      pt_desc1          at 45 no-label
    SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space
    NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = (getFrameTitle("CONTENTS_(CONTAINERS)",30)).
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



   /* SET EXTERNAL LABELS */
   setFrameLabels(frame a:handle).
end.

find abs_mstr where recid(abs_mstr) = abs_recid no-lock.
global_recid = abs_recid.

assign
   global_addr = abs_shipfrom
   global_site = abs_shipto.

/* VALIDATE IF LOGISTICS ACCOUNTING IS TURNED ON */
{gprun.i ""lactrl.p"" "(output use-log-acctg)"}
/*GUI*/ if global-beam-me-up then undo, leave.


repeat for abs_mstr_cont with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


   prompt-for
      abs_cont_id
   go-on(F5 CTRL-D) editing:

      {mfnp05.i abs_mstr_cont abs_par_id
         "abs_shipfrom = abs_mstr.abs_shipfrom and
           abs_par_id = abs_mstr.abs_id
           and abs_id begins ""c"" "
         abs_id "input abs_cont_id"}

      if recno <> ? then do:
         clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
         {pxmsg.i &MSGNUM=8221 &ERRORLEVEL=1}  /* F5 to delete */
         find pt_mstr where pt_part = abs_item no-lock no-error.
         display
            substring(abs_id,2,12) @ abs_cont_id
            pt_desc1 when (available pt_mstr).
      end.

   end.

   find abs_mstr_cont where abs_shipfrom = abs_mstr.abs_shipfrom
      and abs_id = "c" + input abs_cont_id
      and abs_type = "r"
   exclusive-lock no-error.

   if not available abs_mstr_cont then do:
      /* Container id from this supplier does not exist */
      {pxmsg.i &MSGNUM=8196 &ERRORLEVEL=3}
      bell.
      undo, retry.
   end.

   if use-log-acctg then do:

      {gprunmo.i &module = "LA" &program = "lashmta.p"
                 &param  = """(input abs_recid,
                               input (input abs_cont_id),
                               input abs_mstr.abs_shipfrom,
                               output undo-retry)"""}

      if undo-retry then
         undo, retry.

      for first abs_mstr_cont
         where abs_shipfrom = abs_mstr.abs_shipfrom
         and abs_id = "c" + input abs_cont_id
         and abs_type = "r"
         exclusive-lock:
      end.

   end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* if use-log-acctg */

   if abs_mstr.abs_id = abs_mstr_cont.abs_id then do:
      /* Same id as parent not allowed */
      {pxmsg.i &MSGNUM=8197 &ERRORLEVEL=3}
      bell.
      undo, retry.
   end.

   if abs_par_id > "" and abs_par_id <> abs_mstr.abs_id then do:
      /* Container ID already assigned to Shipper/Container */
      {pxmsg.i &MSGNUM=8223 &ERRORLEVEL=3 &MSGARG1=abs_par_id}
      undo, retry.
   end.

   {rcshmta1.i}

   find pt_mstr where pt_part = abs_item no-lock no-error.
   find abs_mstr where recid(abs_mstr) = abs_recid exclusive-lock.

   display
      pt_desc1 when (available pt_mstr).

   if lastkey = keycode("F5") or lastkey = keycode("CTRL-D")
   then do:

      del-yn = yes.
      /* Please confirm delete */
      {pxmsg.i &MSGNUM=11 &ERRORLEVEL=1 &CONFIRM=del-yn}

      if del-yn = no then undo, retry.

      abs_par_id = "".
      clear.
      next.

   end.

   abs_par_id = abs_mstr.abs_id.

end.
